<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('diymodel_add');

//模型标识
if(!empty($m))
{
	$r = $dosql->GetOne("SELECT * FROM `#@__diymodel` WHERE `modelname`='$m'");
	if(empty($r) && !is_array($r))
	{
		echo '<script>history.go(-1);</script>';
		exit();
	}
}
else
{
	echo '<script>history.go(-1);</script>';
	exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>添加<?php echo $r['modeltitle']; ?></title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/jquery.nicescroll.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/laymain.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/getuploadify.js"></script>
<script type="text/javascript" src="templates/js/getinfosrc.js"></script>
<script type="text/javascript" src="plugin/colorpicker/colorpicker.js"></script>
<script type="text/javascript" src="plugin/calendar/calendar.js"></script>
<script type="text/javascript" src="../plugin/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="../plugin/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
   $(function () {
        //初始化表单验证
        $("#form").initValidform();
    });
	//自定义字段通过AJAX来输出时需要提前声明
var editor;
KindEditor.ready(function(K) { });
</script>
</head>

<body class="mainbody">
<?php
$defaultfield = array();
$defaultfield = explode(',', $r['defaultfield']);
?>
<form name="form" id="form" method="post" action="modeldata_save.php" >
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回列表页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <a href="javascript:history.back(-1);"><span>内容管理</span></a>
  <i class="arrow"></i>
  <span>添加<?php echo $r['modeltitle']; ?></span>
  <a href="javascript:location.reload();" class="reload">刷新</a> 
</div>
<div class="line10"></div>
<!--/导航栏-->

<!--内容-->
<div id="floatHead" class="content-tab-wrap">
  <div class="content-tab">
    <div class="content-tab-ul-wrap">
      <ul>
        <li><a class="selected" href="javascript:;"><?php echo $r['modeltitle']; ?>信息</a></li>
      </ul>
    </div>
  </div>
</div>

<div class="tab-content">
  <dl>
    <dt>所属类别</dt>
    <dd>
      <div class="rule-single-select">
        <select name="classid" id="classid" datatype="n1-16" sucmsg=" " errormsg="请选择栏目！">
		<option value="-1">请选择类别...</option>
			<?php CategoryMyType($r['id']); ?>
		</select>
      </div>
    </dd>
  </dl>
  <?php
		if(in_array('title', $defaultfield))
		{
		?>
		<dl>
			<dt>内容标题</dt>
			<dd>
				<input name="title" type="text" value="" id="title" class="input normal" datatype="*1-255" sucmsg=" " />
			  <span class="Validform_checktip">*标题最多255个字符</span>
			</dd>
		</dl>
		<?php
		}
		if(in_array('flag', $defaultfield))
		{
		?>
			<dl>
			<dt>属性</dt>
			<dd>
			  <div class="rule-multi-checkbox" id="flagss">
				<?php
					echo GetFlagClass($cid);
				?>
			  </div>
			</dd>
		  </dl>
		<?php
		}
		?>
		<?php
		if(in_array('picurl', $defaultfield))
		{
		?>
	  
		  <dl>
			<dt>封面图片</dt>
			<dd>
			 <input name="picurl" type="text" id="picurl" class="input normal" value="" /> <div class="upload-box upload-img">
			<div class="webuploader-pick"  onmousemove="this.className='webuploader-pick webuploader-pick-hover'" onmouseout="this.className='webuploader-pick'" onclick="GetUploadify('uploadify','缩略图上传','image','image',1,<?php echo $cfg_max_file_size; ?>,'picurl')">浏览...</div> <span class="rePicTxt">
			<input type="checkbox" name="rempic" id="rempic" value="true" />
			远程</span></div>
			</dd>
		  </dl>
		<?php
		}
		?>
		 <div id="df">
			<?php if(isset($cid)) echo GetDiyField($r['id'],$cid); ?>
		</div>
		<?php
		if(in_array('orderid', $defaultfield))
		{
		?>

			<dl>
		<dt>排序数字</dt>
		<dd>
		  <input name="orderid" type="text" value="99" id="orderid" class="input small" datatype="n" sucmsg=" " />
		  <span class="Validform_checktip">*数字，越小越向前</span>
		</dd>
	  </dl>
		<?php
		}

		if(in_array('posttime', $defaultfield))
		{
		?>
	  <dl>
    <dt>发布时间</dt>
    <dd>
      <input name="posttime" type="text" value="<?php echo GetDateTime(time()); ?>" id="posttime" class="input rule-date-input"  datatype="/^\s*$|^\d{4}\-\d{1,2}\-\d{1,2}\s{1}(\d{1,2}:){2}\d{1,2}$/" errormsg="请选择正确的日期" sucmsg=" " />
      <span class="Validform_checktip">不选择默认当前发布时间</span>
	<script type="text/javascript">
				date = new Date();
				Calendar.setup({
					inputField     :    "posttime",
					ifFormat       :    "%Y-%m-%d %H:%M:%S",
					showsTime      :    true,
					timeFormat     :    "24"
				});
				</script>
    </dd>
  </dl>
		<?php
		}
		?>
  <dl>
    <dt>显示状态</dt>
    <dd>
      <div class="rule-multi-radio">
        <span id="checkinfo"><input id="checkinfo_1" type="radio" name="checkinfo" value="true" checked="checked" /><label for="checkinfo_1">审核</label>
		<input id="checkinfo_2" type="radio" name="checkinfo" value="false" /><label for="checkinfo_2">未审</label>
		</span>
      </div>
    </dd>
  </dl>
</div>
<!--/内容-->

<!--工具栏-->
<div class="page-footer">
  <div class="btn-wrap">
  <input type="submit" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" />
    <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript:history.back(-1);" />
	<input type="hidden" name="action" id="action" value="add" />
	<input type="hidden" name="m" id="m" value="<?php echo $m; ?>" />
  </div>
</div>
<!--/工具栏-->

</form>
</body>
</html>